﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TechMadeira.Core.Logging
{
    public class LineNumberRecorderDecorator : RecorderDecorator
    {
        public LineNumberRecorderDecorator( IRecorder aRecorder ) : base( aRecorder )
        {
        }

        private int LineNumber { get; set; }

        public override void Record( string aFormat, params object[] aArgs )
        {
            var buffer = new StringBuilder();

            buffer.Append( ++LineNumber );
            buffer.Append( " : " );
            buffer.Append( aFormat );
            Recorder.Record( buffer.ToString(), aArgs );
        }
    }
}
